CHARTS
Don’t call the world dirty because you forgot to clean your glasses…
— Aaron Hill
# Load data
df = read.csv("archetypes/family-policy-scores-by-country/family-policy-scores-by-country.csv", header = TRUE, stringsAsFactors = TRUE)
df
theme_opts <- theme(
plot.margin = margin(.25, 1, .25, .25, "cm"),
plot.background = element_blank(),
panel.background = element_blank(),
legend.position = "none",
axis.title.x=element_blank(),
axis.title.y=element_blank(),
axis.ticks.y=element_blank(),
axis.ticks.x=element_blank(),
axis.text.x=element_blank(),
strip.placement = "outside", # Place facet labels outside x axis labels.
strip.background = element_rect(fill = "white"), # Make facet label background white.
axis.title = element_blank() # Remove x and y axis titles.
)
# Make the plot
v1 <- ggplot(df, aes(x=Family.Integration.Policy.Average.Scores, y=Country)) +
geom_bar(stat="identity", fill="#88b88a") +
# scale_y_discrete(limits=c("Almond milk", "Oat milk", "Soy milk", "Rice milk","Cow's milk")) +
#scale_fill_manual(values=c("Carbon Emissions (kg CO2eq)" = "#364e5d", "Land Use (m2)" = "#597e4e", "Water Use (L)" = "#587f89")) +
#scale_color_manual(values=c("white" = "#ffffff", "black" = "#000000")) +
coord_cartesian(clip="off") +
labs(title = "FAMILY INTEGRATION POLICY AVERAGE SCORES BY COUNTRY, 2014") +
theme_opts
# Print the plot
v1
theme_opts <- theme(
plot.margin = margin(.25, 1, .25, .25, "cm"),
plot.background = element_blank(),
panel.background = element_blank(),
legend.position = "none",
axis.title.x=element_blank(),
axis.title.y=element_blank(),
axis.ticks.y=element_blank(),
axis.ticks.x=element_blank(),
axis.text.x=element_blank(),
strip.placement = "outside", # Place facet labels outside x axis labels.
strip.background = element_rect(fill = "white"), # Make facet label background white.
axis.title = element_blank() # Remove x and y axis titles.
)
# Make the plot
v2 <- ggplot(df, aes(x=Family.Integration.Policy.Average.Scores, y=reorder(Country,Family.Integration.Policy.Average.Scores))) +
geom_bar(stat="identity", fill="#88b88a") +
# scale_y_discrete(limits=c("Almond milk", "Oat milk", "Soy milk", "Rice milk","Cow's milk")) +
#scale_fill_manual(values=c("Carbon Emissions (kg CO2eq)" = "#364e5d", "Land Use (m2)" = "#597e4e", "Water Use (L)" = "#587f89")) +
#scale_color_manual(values=c("white" = "#ffffff", "black" = "#000000")) +
coord_cartesian(clip="off") +
labs(title = "FAMILY INTEGRATION POLICY AVERAGE SCORES BY COUNTRY, 2014") +
theme_opts
# Print the plot
v2
theme_opts <- theme(
plot.margin = margin(.25, 1, .25, .25, "cm"),
plot.background = element_blank(),
panel.background = element_blank(),
legend.position = "none",
axis.title.x=element_blank(),
axis.title.y=element_blank(),
axis.ticks.y=element_blank(),
axis.ticks.x=element_blank(),
axis.text.x=element_blank(),
strip.placement = "outside", # Place facet labels outside x axis labels.
strip.background = element_rect(fill = "white"), # Make facet label background white.
axis.title = element_blank() # Remove x and y axis titles.
)
# Make the plot
v3 <- ggplot(df, aes(x=Family.Integration.Policy.Average.Scores, y=reorder(Country,-Family.Integration.Policy.Average.Scores))) +
geom_bar(stat="identity", fill="#88b88a") +
# scale_y_discrete(limits=c("Almond milk", "Oat milk", "Soy milk", "Rice milk","Cow's milk")) +
#scale_fill_manual(values=c("Carbon Emissions (kg CO2eq)" = "#364e5d", "Land Use (m2)" = "#597e4e", "Water Use (L)" = "#587f89")) +
#scale_color_manual(values=c("white" = "#ffffff", "black" = "#000000")) +
coord_cartesian(clip="off") +
labs(title = "FAMILY INTEGRATION POLICY AVERAGE SCORES BY COUNTRY, 2014") +
theme_opts
# Print the plot
v3
theme_opts <- theme(
plot.margin = margin(.25, 1, .25, .25, "cm"),
plot.background = element_blank(),
panel.background = element_blank(),
legend.position = "none",
axis.title.x=element_blank(),
axis.title.y=element_blank(),
axis.ticks.y=element_blank(),
axis.ticks.x=element_blank(),
axis.text.x=element_blank(),
strip.placement = "outside", # Place facet labels outside x axis labels.
strip.background = element_rect(fill = "white"), # Make facet label background white.
axis.title = element_blank() # Remove x and y axis titles.
)
# Make the plot
make_hbar <- function(df, x_field, y_field, fill_str, title_str) {
x_var <- c(x_field)
y_var <- c(y_field)
ggplot(df, aes(x=get(x_var), y=get(y_var))) +
geom_bar(stat="identity", fill=fill_str) +
coord_cartesian(clip="off") +
labs(title = title_str) +
theme_opts
}
# Print the plot
v1 <- make_hbar(df, "Family.Integration.Policy.Average.Scores", "Country", "#88b88a", "FAMILY INTEGRATION POLICY AVERAGE SCORES BY COUNTRY, 2014")
v1
## [1] I. U. Migration. _World Migration Report 2015_. International
## Organization for Migration, Aug. 2015. <URL:
## https://www.iom.int/world-migration-report-2015> (visited on
## 06/22/2021).
##
## [2] U. Nations. _World Population Policy - United Nations Population
## Division | Department of Economic and Social Affairs_. www.un.org, Jun.
## 22, 2021. <URL:
## https://www.un.org/en/development/desa/population/publications/policy/international-migration-policies-report-2013.asp>
## (visited on 06/22/2021).